/**
 * argv-infor.js
 * ["username","age","sex"]
 * 
 * username age sex的值通过命令行参数传入
 * 生成一个对象结构
 * 遍历该对象，在终端中输出键名、键值
 */

let argvs = process.argv;
let obj = {};
let arr = ["username", "age", "sex"];

let username = argvs[2];
let age = argvs[3];
let sex = argvs[4];

for (let i = 0; i < arr.length; i++){
    obj[arr[i]] = argvs[i + 2];
}

console.log(obj);

for(let key in obj){
    console.log(key, obj[key]);
}